package org.siqisource.webstart.patch.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.siqisource.webstart.core.utils.condition.Condition;
import org.siqisource.webstart.patch.model.Patch;
import org.siqisource.webstart.patch.model.PatchCtrl;
import org.siqisource.webstart.patch.service.PatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class PatchController {

	@Autowired
	PatchService patchService;
	
	
	@RequestMapping("/patch/PatchController/list.do")
	public String list(Patch patch, PatchCtrl ctrl, Model model) {
		return "/patch/patchList";
	}
	
	@RequestMapping("/patch/PatchController/listData.do")
	@ResponseBody
	public Map<String,List<Patch>> listData(Patch patch, PatchCtrl ctrl, Model model) {
		List<Patch> patchList = patchService.listPage(new Condition(),ctrl.getRowBounds());
		Map<String,List<Patch>> mpResult = new HashMap<String,List<Patch>>();
		mpResult.put("list", patchList);
		return mpResult;
	}
}
